
package std.math.numeric
import std.convert.*
import std.math.*
import std.random.*


@!APILevel[
    since: "22"
]
public struct BigInt <: Comparable<BigInt> & Hashable & ToString {
    @!APILevel[
        since: "22"
    ]
    public prop sign: Int64
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public prop bitLen: Int64
    
    /**
    * @throws ArithmeticException
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public static func randomProbablePrime(bitLen: Int64, certainty: UInt64, rand!: Random = Random()): BigInt
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(bytes: Array<Byte>)
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(sign: Bool, magnitude: Array<Byte>)
    
    @!APILevel[
        since: "22"
    ]
    public init(n: Int8)
    
    @!APILevel[
        since: "22"
    ]
    public init(n: Int16)
    
    @!APILevel[
        since: "22"
    ]
    public init(n: Int32)
    
    @!APILevel[
        since: "22"
    ]
    public init(n: Int64)
    
    @!APILevel[
        since: "22"
    ]
    public init(n: UInt8)
    
    @!APILevel[
        since: "22"
    ]
    public init(n: UInt16)
    
    @!APILevel[
        since: "22"
    ]
    public init(n: UInt32)
    
    @!APILevel[
        since: "22"
    ]
    public init(n: UInt64)
    
    @!APILevel[
        since: "22"
    ]
    public init(n: UIntNative)
    
    @!APILevel[
        since: "22"
    ]
    public init(n: IntNative)
    
    /**
    * @throws ArithmeticException
    * @throws PrecisionMismatchException
    * @throws IllegalArgumentException
    * @throws OverflowException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(n: Float16)
    
    /**
    * @throws ArithmeticException
    * @throws PrecisionMismatchException
    * @throws IllegalArgumentException
    * @throws OverflowException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(n: Float32)
    
    /**
    * @throws ArithmeticException
    * @throws PrecisionMismatchException
    * @throws IllegalArgumentException
    * @throws OverflowException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(n: Float64)
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(sign: Bool, bitLen: Int64, rand!: Random = Random())
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @Deprecated[message: "Use member function `public static func parse(value: String, radix!: Int64): BigInt` instead."]
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(s: String, base!: Int64 = 10)
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func testBit(index: Int64): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @Deprecated[message: "Use global function `public func trailingZeros(x: BigInt): Int64` instead."]
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func lowestOneBit(): Int64
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func setBit(index: Int64): BigInt
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func clearBit(index: Int64): BigInt
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func flipBit(index: Int64): BigInt
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func isProbablePrime(certainty: UInt64): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func +(that: BigInt): BigInt
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func -(that: BigInt): BigInt
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func *(that: BigInt): BigInt
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws ArithmeticException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func /(that: BigInt): BigInt
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func %(that: BigInt): BigInt
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws ArithmeticException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func divAndMod(that: BigInt): (BigInt, BigInt)
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @Deprecated[message: "Use member function `public func divAndMod(that: BigInt): (BigInt, BigInt)` instead."]
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func quo(that: BigInt): BigInt
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @Deprecated[message: "Use member function `public func divAndMod(that: BigInt): (BigInt, BigInt)` instead."]
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func rem(that: BigInt): BigInt
    
    /**
    * @throws ArithmeticException
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @Deprecated[message: "Use member function `public func divAndMod(that: BigInt): (BigInt, BigInt)` instead."]
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func quoAndRem(that: BigInt): (BigInt, BigInt)
    
    /**
    * @throws ArithmeticException
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func modInverse(that: BigInt): BigInt
    
    @!APILevel[
        since: "22"
    ]
    public operator func -(): BigInt
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func **(n: UInt64): BigInt
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func modPow(n: BigInt, m!: ?BigInt = None): BigInt
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func &(that: BigInt): BigInt
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func |(that: BigInt): BigInt
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func ^(that: BigInt): BigInt
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func !(): BigInt
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws ArithmeticException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func >>(n: Int64): BigInt
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws ArithmeticException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func <<(n: Int64): BigInt
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func ==(that: BigInt): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func !=(that: BigInt): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func >(that: BigInt): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func >=(that: BigInt): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func <(that: BigInt): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func <=(that: BigInt): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func compare(that: BigInt): Ordering
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @OverflowWrapping
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func hashCode(): Int64
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toString(): String
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toBytes(): Array<Byte>
    
    /**
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toInt8(overflowHandling!: OverflowStrategy = Throwing): Int8
    
    /**
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toInt16(overflowHandling!: OverflowStrategy = Throwing): Int16
    
    /**
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toInt32(overflowHandling!: OverflowStrategy = Throwing): Int32
    
    /**
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toInt64(overflowHandling!: OverflowStrategy = Throwing): Int64
    
    /**
    * @throws OverflowException
    * @throws Exception
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toIntNative(overflowHandling!: OverflowStrategy = Throwing): IntNative
    
    /**
    * @throws ArithmeticException
    * @throws PrecisionMismatchException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toFloat16(): Float16
    
    /**
    * @throws ArithmeticException
    * @throws PrecisionMismatchException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toFloat32(): Float32
    
    /**
    * @throws ArithmeticException
    * @throws PrecisionMismatchException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toFloat64(): Float64
    
    /**
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toUInt8(overflowHandling!: OverflowStrategy = Throwing): UInt8
    
    /**
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toUInt16(overflowHandling!: OverflowStrategy = Throwing): UInt16
    
    /**
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toUInt32(overflowHandling!: OverflowStrategy = Throwing): UInt32
    
    /**
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toUInt64(overflowHandling!: OverflowStrategy = Throwing): UInt64
    
    /**
    * @throws OverflowException
    * @throws Exception
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toUIntNative(overflowHandling!: OverflowStrategy = Throwing): UIntNative
}

@!APILevel[
    since: "22"
]
public func abs(i: BigInt): BigInt

/**
* @throws ArithmeticException
* @throws IndexOutOfBoundsException
* @throws IllegalArgumentException
*/
@!APILevel[
    since: "22",
    throwexception: true
]
public func sqrt(i: BigInt): BigInt

/**
* @throws IndexOutOfBoundsException
* @throws IllegalArgumentException
*/
@!APILevel[
    since: "22",
    throwexception: true
]
public func gcd(i1: BigInt, i2: BigInt): BigInt

/**
* @throws ArithmeticException
* @throws IllegalArgumentException
* @throws IndexOutOfBoundsException
*/
@!APILevel[
    since: "22",
    throwexception: true
]
public func lcm(i1: BigInt, i2: BigInt): BigInt

/**
* @throws IndexOutOfBoundsException
*/
@Deprecated[message: "Use global function `public func countOnes(i: BigInt): Int64` instead."]
@!APILevel[
    since: "22",
    throwexception: true
]
public func countOne(i: BigInt): Int64

/**
* @throws IndexOutOfBoundsException
*/
@!APILevel[
    since: "22",
    throwexception: true
]
public func countOnes(i: BigInt): Int64

/**
* @throws IndexOutOfBoundsException
*/
@!APILevel[
    since: "22",
    throwexception: true
]
public func trailingZeros(x: BigInt): Int64


extend BigInt <: Integer<BigInt> {
    @!APILevel[
        since: "22"
    ]
    public static func isSigned(): Bool
}

extend BigInt <: Parsable<BigInt> {
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public static func parse(value: String): BigInt
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public static func tryParse(value: String): ?BigInt
}

extend BigInt <: RadixConvertible<BigInt> {
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public static func parse(value: String, radix!: Int64): BigInt
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public static func tryParse(value: String, radix!: Int64): ?BigInt
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toString(radix!: Int64): String
}

extend BigInt <: Formattable {
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func format(fmt: String): String
}

@!APILevel[
    since: "22"
]
public struct Decimal <: Comparable<Decimal> & Hashable & ToString {
    @!APILevel[
        since: "22"
    ]
    public prop scale: Int32
    
    @!APILevel[
        since: "22"
    ]
    public prop precision: Int64
    
    @!APILevel[
        since: "22"
    ]
    public prop value: BigInt
    
    @!APILevel[
        since: "22"
    ]
    public prop sign: Int64
    
    /**
    * @throws OverflowException
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @Deprecated[message: "Use member function `public static func parse(value: String): Decimal` instead."]
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(val: String)
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(val: BigInt, scale: Int32)
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(val: BigInt)
    
    /**
    * @throws OverflowException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(val: Int8)
    
    /**
    * @throws OverflowException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(val: Int16)
    
    /**
    * @throws OverflowException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(val: Int32)
    
    /**
    * @throws OverflowException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(val: IntNative)
    
    /**
    * @throws OverflowException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(val: Int64)
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(val: UInt8)
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(val: UInt16)
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(val: UInt32)
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(val: UIntNative)
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(val: UInt64)
    
    /**
    * @throws OverflowException
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(val: Float16)
    
    /**
    * @throws OverflowException
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(val: Float32)
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws OverflowException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public init(val: Float64)
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func +(d: Decimal): Decimal
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func -(d: Decimal): Decimal
    
    /**
    * @throws IllegalArgumentException
    * @throws OverflowException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func *(d: Decimal): Decimal
    
    /**
    * @throws PrecisionMismatchException
    * @throws IllegalArgumentException
    * @throws OverflowException
    * @throws IndexOutOfBoundsException
    * @throws ArithmeticException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func /(d: Decimal): Decimal
    
    /**
    * @throws PrecisionMismatchException
    * @throws IllegalArgumentException
    * @throws OverflowException
    * @throws IndexOutOfBoundsException
    * @throws ArithmeticException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func divWithPrecision(d: Decimal, precision: Int64, roundingMode!: RoundingMode = HalfEven): Decimal
    
    /**
    * @throws ArithmeticException
    * @throws PrecisionMismatchException
    * @throws IllegalArgumentException
    * @throws OverflowException
    * @throws IndexOutOfBoundsException
    */
    @Deprecated[message: "Use member function `public func divAndMod(d: Decimal): (BigInt, Decimal)` instead."]
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func divAndRem(d: Decimal): (BigInt, Decimal)
    
    /**
    * @throws ArithmeticException
    * @throws PrecisionMismatchException
    * @throws IllegalArgumentException
    * @throws OverflowException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func divAndMod(d: Decimal): (BigInt, Decimal)
    
    @!APILevel[
        since: "22"
    ]
    public operator func -(): Decimal
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func shiftPoint(n: Int32): Decimal
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws OverflowException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func roundWithPrecision(precision: Int64, roundingMode!: RoundingMode = RoundingMode.HalfEven): Decimal
    
    /**
    * @throws IllegalArgumentException
    * @throws OverflowException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func <(d: Decimal): Bool
    
    /**
    * @throws IllegalArgumentException
    * @throws OverflowException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func >(d: Decimal): Bool
    
    /**
    * @throws IllegalArgumentException
    * @throws OverflowException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func <=(d: Decimal): Bool
    
    /**
    * @throws IllegalArgumentException
    * @throws OverflowException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func >=(d: Decimal): Bool
    
    /**
    * @throws IllegalArgumentException
    * @throws OverflowException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func ==(d: Decimal): Bool
    
    /**
    * @throws IllegalArgumentException
    * @throws OverflowException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func !=(d: Decimal): Bool
    
    /**
    * @throws IllegalArgumentException
    * @throws OverflowException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func compare(d: Decimal): Ordering
    
    /**
    * @throws PrecisionMismatchException
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public operator func **(n: Int64): Decimal
    
    /**
    * @throws PrecisionMismatchException
    * @throws IllegalArgumentException
    * @throws OverflowException
    * @throws IndexOutOfBoundsException
    * @throws ArithmeticException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func powWithPrecision(n: Int64, precision: Int64, roundingMode!: RoundingMode = RoundingMode.HalfEven): Decimal
    
    /**
    * @throws PrecisionMismatchException
    * @throws ArithmeticException
    * @throws IndexOutOfBoundsException
    * @throws OverflowException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func sqrtWithPrecision(precision: Int64, roundingMode!: RoundingMode = RoundingMode.HalfEven): Decimal
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws OverflowException
    * @throws IndexOutOfBoundsException
    */
    @OverflowWrapping
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func hashCode(): Int64
    
    /**
    * @throws IllegalArgumentException
    * @throws OverflowException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toString(): String
    
    /**
    * @throws ArithmeticException
    * @throws PrecisionMismatchException
    * @throws IllegalArgumentException
    * @throws OverflowException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func reScale(newScale: Int32, roundingMode!: RoundingMode = HalfEven): Decimal
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func removeTrailingZeros(): Decimal
    
    @!APILevel[
        since: "22"
    ]
    public func scaleUnit(): Decimal
    
    /**
    * @throws ArithmeticException
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func isInteger(): Bool
    
    /**
    * @throws ArithmeticException
    * @throws PrecisionMismatchException
    * @throws IllegalArgumentException
    * @throws OverflowException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toInt8(overflowHandling!: OverflowStrategy = Throwing): Int8
    
    /**
    * @throws ArithmeticException
    * @throws PrecisionMismatchException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toInt16(overflowHandling!: OverflowStrategy = Throwing): Int16
    
    /**
    * @throws ArithmeticException
    * @throws PrecisionMismatchException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toInt32(overflowHandling!: OverflowStrategy = Throwing): Int32
    
    /**
    * @throws ArithmeticException
    * @throws PrecisionMismatchException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toInt64(overflowHandling!: OverflowStrategy = Throwing): Int64
    
    /**
    * @throws ArithmeticException
    * @throws PrecisionMismatchException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws OverflowException
    * @throws Exception
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toIntNative(overflowHandling!: OverflowStrategy = Throwing): IntNative
    
    /**
    * @throws ArithmeticException
    * @throws PrecisionMismatchException
    * @throws IllegalArgumentException
    * @throws OverflowException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toUInt8(overflowHandling!: OverflowStrategy = Throwing): UInt8
    
    /**
    * @throws ArithmeticException
    * @throws PrecisionMismatchException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toUInt16(overflowHandling!: OverflowStrategy = Throwing): UInt16
    
    /**
    * @throws ArithmeticException
    * @throws PrecisionMismatchException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toUInt32(overflowHandling!: OverflowStrategy = Throwing): UInt32
    
    /**
    * @throws ArithmeticException
    * @throws PrecisionMismatchException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toUInt64(overflowHandling!: OverflowStrategy = Throwing): UInt64
    
    /**
    * @throws ArithmeticException
    * @throws PrecisionMismatchException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws OverflowException
    * @throws Exception
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toUIntNative(overflowHandling!: OverflowStrategy = Throwing): UIntNative
    
    /**
    * @throws ArithmeticException
    * @throws PrecisionMismatchException
    * @throws IllegalArgumentException
    * @throws OverflowException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toBigInt(): BigInt
    
    /**
    * @throws ArithmeticException
    * @throws PrecisionMismatchException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toFloat16(): Float16
    
    /**
    * @throws ArithmeticException
    * @throws PrecisionMismatchException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toFloat32(): Float32
    
    /**
    * @throws ArithmeticException
    * @throws PrecisionMismatchException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toFloat64(): Float64
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toEngString(): String
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func toSciString(): String
}

@!APILevel[
    since: "22"
]
public func abs(d: Decimal): Decimal

/**
* @throws ArithmeticException
* @throws PrecisionMismatchException
* @throws IllegalArgumentException
* @throws OverflowException
* @throws IndexOutOfBoundsException
*/
@!APILevel[
    since: "22",
    throwexception: true
]
public func round(d: Decimal, roundingMode!: RoundingMode = RoundingMode.HalfEven): Decimal

/**
* @throws PrecisionMismatchException
* @throws ArithmeticException
* @throws IndexOutOfBoundsException
* @throws OverflowException
* @throws IllegalArgumentException
*/
@!APILevel[
    since: "22",
    throwexception: true
]
public func sqrt(d: Decimal): Decimal


@!APILevel[
    since: "22"
]
public enum OverflowStrategy <: Equatable<OverflowStrategy> & ToString {
    @!APILevel[
        since: "22"
    ]
    Saturating |
    @!APILevel[
        since: "22"
    ]
    Throwing |
    @!APILevel[
        since: "22"
    ]
    Wrapping
    @!APILevel[
        since: "22"
    ]
    public operator func ==(that: OverflowStrategy): Bool
    
    @!APILevel[
        since: "22"
    ]
    public func toString(): String
}

extend Decimal <: Parsable<Decimal> {
    /**
    * @throws OverflowException
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public static func parse(value: String): Decimal
    
    /**
    * @throws OverflowException
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public static func tryParse(value: String): ?Decimal
}

extend Decimal <: Formattable {
    /**
    * @throws ArithmeticException
    * @throws PrecisionMismatchException
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        throwexception: true
    ]
    public func format(fmt: String): String
}

